package org.csmzxy.class2333;
class CarFactory {
    private static int totalCars = 0;
    public static void produceCar() {
        totalCars++;
        System.out.println("生产了一辆汽车，当前生产线上汽车数量: " + totalCars);
    }
    public static int getTotalCars() {
        return totalCars;
    }
}
public class example11 {
    public static void main(String[] args) {
        CarFactory.produceCar();
        CarFactory.produceCar();
        CarFactory.produceCar();
        CarFactory.produceCar();
        System.out.println("当前生产线上汽车的总数量为" + CarFactory.getTotalCars());
    }
}
